package org.itcast.danamicdatasource.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import org.itcast.danamicdatasource.Dao.FriendDao;
import org.itcast.danamicdatasource.pojo.Friend;
import org.itcast.danamicdatasource.service.FriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FriendServiceImpl implements FriendService {

    @Autowired
    private FriendDao friendDao;

    @Override
    public List<Friend> findListDatas() {
        return friendDao.findListDatas();
    }

    @Override
    public List<Friend> findMastDatas() {
        return friendDao.findListDatas();
    }

    @Override
    @DS("slave_1")
    public List<Friend> findSlaveDatas() {
        return friendDao.findListDatas();
    }
}
